Skip to content

Conversation

pls148
Copy link
Contributor

@pls148 pls148 commented Oct 1, 2025

This PR:

  • Adds support for genesis -> da_committees
  • Parsing of da_committees
  • EpochCommittees now holds da_committees as data instead of known_da_nodes

This PR does not:

  • Actually do anything with the new data

Key places to review:

Example da_committees in data/genesis/X.toml:

[da_committees]
0.3 = {
    0 = [
        { stake_table_key = "BLS_VER_KEY~bQszS-QKYvUij2g20VqS8asttGSb95NrTu2PUj0uMh1CBUxNy1FqyPDjZqB29M7ZbjWqj79QkEOWkpga84AmDYUeTuWmy-0P1AdKHD3ehc-dKvei78BDj5USwXPJiDUlCxvYs_9rWYhagaq-5_LXENr78xel17spftNd5MA1Mw5U", state_ver_key = "SCHNORR_VER_KEY~lJqDaVZyM0hWP2Br52IX5FeE-dCAIC-dPX7bL5-qUx-vjbunwe-ENOeZxj6FuOyvDCFzoGeP7yZ0fM995qF-CRE", stake = 1 }
    ]
}

@pls148 pls148 force-pushed the ps/load-da-committee branch 9 times, most recently from 9c100c2 to 99589b4 Compare October 2, 2025 01:17
[(TYPES::Epoch::new(0), self.known_da_nodes.clone())].into()
} else {
if !self.known_da_nodes.is_empty() {
tracing::warn!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be an error

or arguably even a panic -- I think it might be preferable to call this a misconfiguration and immediately panic vs. try to resolve the ambiguity

let da_members = da_committees
.get(&Epoch::new(0))
.cloned()
.unwrap_or_default(); // For testing reasons, we want to support being given an empty map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or_default means return an empty vec here right? I think it would be better to panic, since an empty DA committee is always a (fatal) error

#[serde(default)]
pub upgrades: BTreeMap<Version, Upgrade>,
#[serde(default)]
pub da_committees: Option<BTreeMap<TomlKeyU64, Vec<PeerConfigData>>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A BTreeMap can be null right? do we need to make this an Option?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also is there a reason it needs to be in both HotShotConfig and Genesis?

do we use it out of HotShotConfig anywhere? (I think it's fine to leave it in both even if we only use it out of genesis, just wondering)

@pls148 pls148 force-pushed the ps/load-da-committee branch 3 times, most recently from 10bf649 to ca9dcbd Compare October 4, 2025 00:33
known_nodes_with_stake: Vec<PeerConfig<SeqTypes>>,
known_da_nodes: Vec<PeerConfig<SeqTypes>>,
#[serde(default)]
da_committees: BTreeMap<Version, BTreeMap<u64, Vec<PeerConfig<SeqTypes>>>>,
Copy link
Contributor

@ss-es ss-es Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the inner BTreeMap is unnecessary -- this should just be a BTreeMap<Version, (u64, PeerConfig<SeqTypes>)>

maybe @bfish713 can comment, but I think it's unlikely that we'd schedule an upgrade with multiple DA committees that take effect at different points in the future? and it definitely complicates the logic

Comment on lines 55 to 62
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct VersionedDaCommittee {
#[serde(with = "version_ser")]
pub start_version: Version,
pub start_epoch: u64,
pub committee: Vec<PeerConfigData>,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this should be imported from hotshot-types instead of re-defined

Comment on lines 395 to 414
tracing::warn!("setting da_committees from genesis");
network_config.config.da_committees = da_committees
.iter()
.map(|src| VersionedDaCommittee::<SeqTypes> {
start_version: src.start_version,
start_epoch: src.start_epoch,
committee: src
.committee
.iter()
.map(|pcd| hotshot_types::PeerConfig {
stake_table_entry: StakeTableEntry {
stake_key: pcd.stake_table_key,
stake_amount: U256::from(pcd.stake),
},
state_ver_key: pcd.state_ver_key.clone(),
})
.collect(),
})
.collect();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I see the reason for any of this -- can't we just use the same type? can't this entire block just be network_config.config.da_committees = da_committees

Comment on lines 280 to 286

pub fn build_da_committees(&self) -> Vec<PeerConfig<TYPES>> {
// TODO: THIS IS A TEMPORARY FIX WITH THE WRONG RETURN TYPE.
// It's done so that we can start using this function and have the existing behavior
// (use known_da_nodes) while we transition to using da_committees.
self.known_da_nodes.clone()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this function is necessary. We can keep the base da_stake_table (or whatever Membership currently stores) separate from the epoch_da_committees that apply at specific epochs, as we do for the full quorum stake table anyway

let mut membership = EpochCommittees::new_stake(
network_config.config.known_nodes_with_stake.clone(),
network_config.config.known_da_nodes.clone(),
network_config.config.build_da_committees(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can (should) remain unchanged

Copy link
Contributor

@ss-es ss-es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's an unused struct that should be deleted, but other than that looks good to me

Comment on lines +48 to +54
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PeerConfigData {
pub stake_table_key: <SeqTypes as NodeType>::SignatureKey,
pub state_ver_key: <SeqTypes as NodeType>::StateSignatureKey,
pub stake: u64,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this struct now unused? if so we should delete it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants